package top.syfy.api.jdcloud.joke.response;

import java.io.Serializable;

/**
 * 统一消息返回
 *
 * @author awg
 * @date 2020/10/30 星期五
 */
public class ContentReturnType implements Serializable {

    private static final long serialVersionUID = -6558135349892830153L;

    // 公共返回参数
    /**
     * 状态码
     */
    private String code;

    /**
     * 状态信息
     */
    private String msg;

    /**
     * API扣费标识: false - 不扣费(默认), true - 扣费
     */
    private Boolean charge;

    /**
     * 返回数据
     */
    private Object result;

    /**
     * 创建数据返回对象
     *
     * @param code 状态码
     * @param msg 状态信息
     * @param charge API扣费标识: false - 不扣费(默认), true - 扣费
     * @param result 返回数据
     * @return 数据返回对象
     */
    public static ContentReturnType of(String code, String msg, Boolean charge, Object result){
        ContentReturnType crt = new ContentReturnType();
        crt.setCode(code);
        crt.setMsg(msg);
        crt.setCharge(charge);
        crt.setResult(result);
        return crt;
    }

    private ContentReturnType() {
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Boolean getCharge() {
        return charge;
    }

    public void setCharge(Boolean charge) {
        this.charge = charge;
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }
}
